<?php
    $messageString = "";
    
    if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
        if ($_POST["submit"] == "Submit")
        {
            $result = ns_dao_user::UserbyUsername($_POST["Username"]);
                    
            if (count($result) == 0)
            {
                $messageString = "Account created";
                $result = ns_dao_user::CreateNewUser($_POST['Username'], md5($_POST['Password']), $_POST['FirstName'], $_POST['LastName'], $_POST['Email'], $_POST['Phone']);
                if ($result != 1)
                {
                    $messageString = "Account creation failed";    
                }
            } else {
                //Can't does user
                $messageString = "Username already taken.";
            }
        }
    }
?>